#include <Arduino.h>
#include <WiFiManager.h>

typedef struct 
{
  String name;
  String value;
}Data_Value_name;
Data_Value_name Value_name1;

const char *ssid="LWT";
const char *password="Wjs717601";
const char *host="dweet.io";

String reques="/dweet/for/LCX_0614?";

String name_="liu_chen_yang=";
String value_="the best";


String httpRequest =  String("GET ") + reques + name_ + value_ +" HTTP/1.1\r\n" +
                        "Host: " + host + "\r\n" +
                        "Connection: close\r\n\r\n";

void setup() 
{
  Serial.begin(115200);
  WiFi.begin(ssid,password);
  while (WiFi.status()!=WL_CONNECTED)//没连接上wifi打印。
  {
    delay(50);
    Serial.print(".");
  }
  if(WiFi.status()==WL_CONNECTED)//连接上了打印ip
  {
    Serial.print("WIFI connected!");
    Serial.print(WiFi.localIP());
  }

}

void loop()
{
  WiFiClient client;
  const int httpport=80;
  if(client.connect(host,httpport))//没有连接上网页
  {
    Serial.println("yes");
    client.print(httpRequest);
    String line=client.readStringUntil('\n');
    Serial.print(line);

  }
  else//连接上发送reques请求
  {
    Serial.println("?");
    delay(1000);
  }

}